sub RenderBasicMenu(X as integer, Y as integer, MenuWidth as integer, MenuData() as MenuType)
	dim as integer CurrentRow
	
	CurrentRow = Y
	color MenuForegroundFont, MenuBackgroundFont

	'Lets print the top of the menu
	locate CurrentRow, x
	CurrentRow += 1
	print chr(BottomRightPlusCode) & string(MenuWidth, HorizontalLine) & chr(BottomLeftPlusCode)

	'Let's display the menu by looping through the data
	for i as integer = lbound(MenuData) to ubound(MenuData)
		with MenuData(i)
			locate CurrentRow, X
			
			if .Text = "" then
				'We need to draw a spacer
				print chr(RightPlusCode) & string(MenuWidth, HorizontalLine) & chr(LeftPlusCode)
				CurrentRow +=1
				continue for
			end if
			
			'We need to draw the text
			locate CurrentRow, X
			print chr(VerticleLine) & .Text & string(MenuWidth - len(.Text), " ") & chr(VerticleLine)
			CurrentRow += 1
		end with
	next
	
	locate CurrentRow, X
	'Now we have the middle displayed. Now, we gotta put down the bottom.
	print chr(TopRIghtPlusCode) & string(MenuWidth, HorizontalLine) & chr(TopLeftPlusCode)
end sub

sub MakeMenu(X as integer, Y as integer, MenuWidth as integer, MenuData() as MenuType)
	dim as any ptr HighlightImage
	'The row we are highlighting right now
	dim as integer HighlightPosition
	
	'So, now we got it all displayed. Let's make the image that will show where we are.
	HighlightImage = imagecreate(TextWidth * MenuWidth, 16, rgb(168, 168, 168))
	
	'Lets highlight the first menu item.
	put (X * TextWidth, Y * TextHeight), HighlightImage

	'start the loop
	do
		'Render the entire screen
		RenderScreen()
		RenderBasicMenu(X, Y, MenuWidth, MenuData())
		RenderMouse()
		sleep 10
		'Now we need to check to see if the user clicked.
		'If so, we exit the do. This do just runs until the user clicks
		'because menus take action when the user releases the mouse
		'button, not pushes it down.
		'Otherwise, lets loop until they do.
	loop until MouseData.Button and LeftMouseButton
	
	'So the user's mouse is down.
	do
		RenderScreen()
		RenderBasicMenu(X, Y, MenuWidth, MenuData())
		RenderMouse()
		sleep 10
		'We need to loop until they release it
	loop while MouseData.Button and LeftMouseButton
	
	'So the user has clicked somewhere. Let's find out where!
	with MouseData
		if .X > X * TextWidth and .X < (X + MenuWidth) * TextWidth then
			'We are in line on the x axis, lets find out where we are
			'on the y axis
			if .Y > Y * TextHeight and .Y < (Y + (1 + ubound(MenuData) - lbound(MenuData))) * TextHeight then
				'We are clicking in the menu.
				'We gotta find out which one we are clicking.
				dim as integer MenuItem
				MenuItem = (.TextY \ TextHeight - Y) + 1
				cls
				color rgb(255, 255, 255), 0
				print MenuData(MenuItem).Text
				sleep 1000, 1
			end if
		end if
	end with
	
	'We get here if the user didn't click on the menu. If they
	'didn't click on the menu, we should redraw the screen
	'and get out of their way.
	RenderScreen()
	
	'Makes it look better when you go off the screen
	locate 1, 1
end sub